<template>
  <div></div>
  <div style="text-align: center">
    <div v-for="(question,index) in questionData" :key="index">
      <h3>
      <span>问题：{{question.name}}</span>
      </h3>
      <textarea rows="3"
                cols="50"
                v-if="question.type == 3"
                v-model="answerList[index]"
      >
					</textarea>
      <el-radio v-if="question.type == 1" v-model="answerList[index]" label="1">{{question.answer1}}</el-radio>
      <el-radio v-if="question.type == 1" v-model="answerList[index]" label="2">{{question.answer2}}</el-radio>
      <el-radio v-if="question.type == 1" v-model="answerList[index]" label="3">{{question.answer3}}</el-radio>
      <el-radio v-if="question.type == 1" v-model="answerList[index]" label="4">{{question.answer4}}</el-radio>
      <el-checkbox-group v-model="answerList[index]">
        <el-checkbox v-if="question.type == 2" label="1">{{question.answer1}}</el-checkbox>
        <el-checkbox v-if="question.type == 2" label="2">{{question.answer2}}</el-checkbox>
        <el-checkbox v-if="question.type == 2" label="3">{{question.answer3}}</el-checkbox>
        <el-checkbox v-if="question.type == 2" label="4">{{question.answer4}}</el-checkbox>
      </el-checkbox-group>
    </div>
  </div>
  <!--<div>
    <el-button type="primary" @click="console.log(answerList)"></el-button>
  </div>
  <div>
    <el-button type="primary" @click="load()"></el-button>
  </div>-->
</template>
<script>
import request from "../../../request/request";
export default {
  name:"preview",
  data(){
    return {
      questionData: {},
      answerList: [],
      isAnswerMode:false
    }
  },
  created(){
    //this.isAnswerMode = this.$route.path === '/answerQuestionnaire'
  },
  methods:{
    load(){
      request.get("question/showQuestionAll").then(res=>{
        this.questionData=res.data
      })
      //this.initAnswerList()
      //this.questionData=this.$route.params.questionData
    },
    init(data){
      this.questionData=data
    },
    //initAnswerList() {
     // let data=Array.from(this.questionData)
     // data.map((question, index) => {
      //  this.$set(this.answerList, index, {
     //     id: question.id,
    //      type: question.type,
    //      answerContent: [0,0,0,0]
    //    })
    //  })
   // },
  }
}
</script>
<style scoped>

</style>